﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FileSystem;
using HotelMatchUtility.Facade;
using HotelMatchUtility.Match;
using System.Threading;
using System.Threading.Tasks;
using HotelMatchUtility.Data;

namespace MyNamespace
{
    class MyClass
    {
    }
}

namespace TestProject
{
    class Program
    {
        private static System.Threading.Timer timer = null;
        //void TestPRint()
        //{
        //    int i = 0;

        //    Random rd = new Random();
        //    Console.WriteLine(i + ":" + rd.Next());

        //    Thread.Sleep(2000);
        //    i++;
        //    Console.WriteLine(i + ":" + rd.Next());

        //    Thread.Sleep(2000);
        //    i++;
        //    Console.WriteLine(i + ":" + rd.Next());
        //}
        static void Main(string[] args)
        {
            //string da = "2014-07-18T10:00+07:00";
            //DateTime Dta = Convert.ToDateTime(da);
            //UtcTimeTest.aExample.Display("Test: ...........", Dta);
            //Console.ReadLine();
            //Doaa();
            DateTime start = DateTime.Now;
            timer = new System.Threading.Timer(p =>
            {
                Console.WriteLine(DateTime.Now + ":[" + MatchFacade.MatchOutName + "][LeftExact:" + MatchFacade.leftNumber + "/"
                    + MatchEntity.ExactLeftNowNumber + "(Hit):" + MatchEntity.ExactHitNumber + "][LeftSim:" + MatchFacade.leftNumber + "/"
                    + MatchEntity.SimLeftNowNumber + "(Hit):" + MatchEntity.SimHitNumber + "][Right:" + MatchFacade.rightNumber + "]");
            }, null, 1000, 1000);

            MatchFacade.StartMatch20141028();
            //int[] messiveList = new int[] { 15, 8, 49, 6, 78, 13, 12, 48, 9, 10, 2003, 16, 25, 31, 32, 1, 2, 87, 98, 102, 202, 5 };
            //SortAlgorithm.QuickSort.Sort(messiveList);
            //Console.ReadLine();

            //try
            //{
            //    Type myType = typeof(MyNamespace.MyClass);
            //    Console.WriteLine("\nPrinting the details of {0}.\n", myType);
            //    // Get the namespace of the class Type_ToString_3.
            //    Console.WriteLine("Namespace: {0}.", myType.Namespace);
            //    // Get the name of the module.
            //    Console.WriteLine("Module: {0}.", myType.Module);
            //    // Get the fully qualified common language runtime namespace.
            //    Console.WriteLine("Fully qualified type: {0}.", myType.ToString());
            //    Console.WriteLine("FullName: {0}.", myType.FullName);
            //    Console.ReadLine();
            //}
            //catch (Exception e)
            //{
            //    Console.WriteLine("Exception: " + e.Message);
            //}
        }

            //Program p = new Program() ;
            //Task ta = null;
            //var tokenSource = new CancellationTokenSource();
            //var token = tokenSource.Token;
            //ta = new Task(() => p.TestPRint(), token);
            //Console.WriteLine("\nTask Start");
            //ta.Start();
            //if (Console.ReadKey().KeyChar == 'c')
            //{
            //    tokenSource.Cancel();
            //    Console.WriteLine("\nTask cancellation requested.");
            //}
            //TestA a = new TestA(1);
            //TestA a2 = new TestA(2);
            //TestB b1 = new TestB();
            //b1.test = a;

            //Queue<TestB> q = new Queue<TestB>();
            //q.Enqueue(b1);
            //b1.test = a2;
            //q.Enqueue(b1);

            //TestB bout1 = q.Dequeue();
            //TestB bout2 = q.Dequeue();
            //Console.WriteLine(bout1.test.i);
            //Console.WriteLine(bout2.test.i);

            //DateTime dtNow = DateTime.Now;
            //dtNow = dtNow.AddHours(12);
            //string hh = dtNow.ToString("HH");
            //int hour = int.Parse(hh);
            //Console.WriteLine(hh);
            //Console.WriteLine(hour);

            //DateTime dtToday = DateTime.Today;
            //Console.WriteLine(string.Format("{0:yyyy-MM-dd HH:mm:ss}", dtNow));

            //int xyx =  (int)(Math.Round(15 * 1.51, 0));

            //Queue<int> xyx = new Queue<int>();

            //Console.WriteLine(xyx.Dequeue());

            //Test 1 Write a file
            //Console.WriteLine("Start to WriteFile");
            //string content = Console.ReadLine();
            //NormalFileWriter.WriteTextToFile(content);
            //string[] drives = System.Environment.GetLogicalDrives();
            //string result = "";

            //result = string.Format("{0},{1},{2}", drives);

            //Console.WriteLine(result);

            //foreach (string dr in drives)
            //{
            //    System.IO.DirectoryInfo diInfo = new System.IO.DirectoryInfo(@"D:\xuyx");
            //    FileFinder.WalkDirectoryTree(diInfo);
            //}

            //Console.WriteLine(GetEpoch(DateTime.Now));

            
            //Console.WriteLine(DateTime.Today.ToString("yyyy-MM-dd HH:mm:ss"));
            //OtherData.update(@"exec [spA_HotelInterface_DownloadJobLoad_u] @JobLoadID = 850144,@CacheContent = '' ,@HotelJobStatus = 0");

            //string aa = "Day";
            //string bb = TypeSS.Day.ToString();

            //Thread t1 = new Thread(GetOne);
            //t1.Name = "1";
            //Thread t2 = new Thread(GetOne);
            //t2.Name = "1";

            //Console.WriteLine(t1.Name);
            //Console.WriteLine(t2.Name);
            //t1.Start();
            //t2.Start();

            //Console.WriteLine("aa=" + aa);
            //Console.WriteLine("bb=" + bb);

        //    Console.ReadLine();
        //}

        public static void GetOne()
        {
        }

        public static string GetEpoch(DateTime dateTime)
        {
            DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
            TimeSpan epochTimeSpan = dateTime.Subtract(dtStart);
            string timeStamp = epochTimeSpan.Ticks.ToString();
            timeStamp = timeStamp.Substring(0, timeStamp.Length - 7);
            return timeStamp;
        }
    }

    public enum TypeSS
    {
        Day,Hour,Minute
    }

    class TestA
    {
        public int i { get; set; }
        public TestA(int i)
        {
            this.i = i;
        }
    }
    class TestB
    {
        public TestA test { get; set; }
        public TestB() { }
    }


    // Use a manual event object.

    // This thread signals the event passed to its constructor.
    

}
